/// @brief Dynamic library external interface implementation
/// @file PluglibPlugin.cpp contains external function for registering the dynamic library

#include "../Pluglib/Engine.hpp"
#include "FirstImplementOfFirst.hpp"
#include "SecondImplementOfFirst.hpp"
#include "FirstImplementOfSecond.hpp"

/// @brief namespace containing plugin classes and functions

using namespace pluglib;

#ifdef _WIN32
extern "C" __declspec(dllexport) void registerPlugin(Engine &engine)
#else
extern "C" void registerPlugin(Engine &engine)
#endif
{
	FactoriesServer<FirstInterface>* factoriesServer = 
		dynamic_cast<FactoriesServer<FirstInterface>*>(engine.getServer(FirstInterfaceFactory::serverName_));
	if (factoriesServer != NULL)
	{
		factoriesServer->addFactory(new FirstFactoryOfFirst());
		factoriesServer->addFactory(new SecondFactoryOfFirst());
	}
	FactoriesServer<SecondInterface>* factoriesServer2 = 
		dynamic_cast<FactoriesServer<SecondInterface>*>(engine.getServer(SecondInterfaceFactory::serverName_));
	if (factoriesServer2 != NULL)
	{
		factoriesServer2->addFactory(new FirstFactoryOfSecond());
	}
}



